package com.yckj.day04;

/**
 * TODO 二维数组的创建和初始化
 *
 * @author shengyuee
 * @version 1.0
 * 2025/7/21 15:49
 */
public class ArrayDemo5 {
    public static void main(String[] args) {
        // 二维数组声明和初始化
        int[][] arr1 = new int[3][4];
        int[][] arr2 = new int[4][];
        arr2[0] = new int[3];
        arr2[1] = new int[4];
        arr2[2] = new int[5];
        arr2[3] = new int[4];
        int[][] arr3 = {{1,2},{3,4,5},{6,7,8,9}};
        // 访问二维数组
        int num = arr3[1][1];
        System.out.println(num);
        // 修改
        arr3[1][2] = 80;
        // 访问第3行的列的个数
        int len = arr3[2].length;
        System.out.println("len = " + len);
    }
}
